package com.lantosec.hmrp.modules.sysdata.vo;

import com.lantosec.hmrp.core.mvc.BaseVO;
import com.lantosec.hmrp.modules.sysdata.entity.SysDataList;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * <p>
 * 系统数据列表定义表 VO对象
 * </p>
 *
 * @author AutoCode
 * @since 2020-03-02
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "SysDataList对象", description = "系统数据列表定义表")
public class SysDataListVO extends BaseVO<SysDataList> {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "数据列表ID")
    private String dataListId;
    @ApiModelProperty(value = "数据列表名称")
    private String dataListName;
    @ApiModelProperty(value = "对应的数据模型ID")
    private String dataModelId;
    @ApiModelProperty(value = "数据列表类型(1系统内表2系统外表)")
    private Integer dataListType;
    @ApiModelProperty(value = "数据列表布局JSON")
    private String dataListLayout;
    @ApiModelProperty(value = "对应的字段名称")
    private String keyField;
    @ApiModelProperty(value = "是否允许编辑标志(0否1是)")
    private Boolean editFlag;
    @ApiModelProperty(value = "SQL语句")
    private String sqlStr;
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    @ApiModelProperty(value = "最后修改时间")
    private Date editTime;

    public SysDataListVO(SysDataList entity) {
        this.dataListId = entity.getDataListId();
        this.dataListName = entity.getDataListName();
        this.dataModelId = entity.getDataModelId();
        this.dataListType = entity.getDataListType();
        this.dataListLayout = entity.getDataListLayout();
        this.keyField = entity.getKeyField();
        this.editFlag = entity.getEditFlag();
        this.sqlStr = entity.getSqlStr();
        this.createTime = entity.getCreateTime();
        this.editTime = entity.getEditTime();
    }

    @Override
    public SysDataList convertToEntity() {
        return new SysDataList(this);
    }


}
